package com.iplant.aps.service.po.aps;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.DBJoinMulti;
import com.iplant.base.utils.annotation.po.DBBasePO;

import java.util.*;

/**
 * 日计划
 */
@DBBasePO(TableName = "aps_task_partpoint_day", Name = false,
        CheckName = {"Code", "TaskPartPointID,StationDate,ShiftType,IsRepairPlan,ProductRepairID"}, CodeAuto = true,
        CodePrefix =
                "APSD" +
                        "-{yyMMdd}-", Schemas = DBSchemas.APS)
public class APSTaskPartPointDay extends BasePO {

    @DBCondition
    @DBField
    public int OrderID = 0;

    @DBJoin(name = "Code", tableName = "oms_order", tableAsName = "oms_order1", Schemas = DBSchemas.APS,
            MainTableField = "OrderID")
    public String OrderNo = "";

    @DBJoin(name = "ProductID", tableName = "oms_order", tableAsName = "oms_order1", Schemas = DBSchemas.APS,
            MainTableField = "OrderID")
    public int ProductID = 0;

    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            JoinIndex = 2,
            ConditionalJoin = "fpc_product1.ID=oms_order1.ProductID")
    public String ProductNo = "";

    @DBField
    public int RoutePartID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fpc_routepart", tableAsName = "fpc_routepart1", Schemas = DBSchemas.PDM,
            MainTableField = "RoutePartID")
    public String RoutePartName = "";

    @DBCondition
    @DBField
    public int RoutePartPointID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public String RoutePartPointName = "";

    @DBJoin(name = "ComponentType", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public int ComponentType = 0;

    @DBJoin(name = "ScanComponentType", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1",
            Schemas = DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public int ScanComponentType = 0;


    @DBCondition
    @DBField
    public int TaskPartID;

    @DBCondition
    @DBJoin(name = "Status", tableName = "aps_task_part", tableAsName = "aps_task_part1", Schemas = DBSchemas.APS,
            MainTableField = "TaskPartID")
    public int TaskPartStatus = 0;

    @DBCondition
    @DBField
    public int TaskPartPointID;
    /**
     * 车间ID
     */
    @DBCondition
    @DBField
    public int WorkShopID = 0;
    @DBJoin(name = "Name", tableName = "fmc_workshop", tableAsName = "workshop1", Schemas = DBSchemas.Basic,
            JoinIndex = 2,
            MainTableField = "WorkShopID")
    public String WorkShopName = "";
    /**
     * 车间编码
     */
    @DBJoin(name = "Code", tableName = "fmc_workshop", tableAsName = "workshop1", Schemas = DBSchemas.Basic,
            JoinIndex = 2,
            MainTableField = "WorkShopID")
    public String WorkShopCode = "";

    /**
     * 工区ID
     */
    @DBCondition
    @DBField
    public int WorkAreaID = 0;
    /**
     * 工区名称
     */
    @DBJoin(name = "Name", tableName = "fmc_workarea", tableAsName = "workarea1", Schemas = DBSchemas.Basic,
            JoinIndex = 3,
            MainTableField = "WorkAreaID")
    public String WorkAreaName = "";
    /**
     * 工区编码
     */
    @DBJoin(name = "Code", tableName = "fmc_workarea", tableAsName = "workarea1", Schemas = DBSchemas.Basic,
            JoinIndex = 3,
            MainTableField = "WorkAreaID")
    public String WorkAreaCode = "";

    @DBField
    public Map<String, Float> StationNumMap = new HashMap<>();


    @DBField
    public Map<String, Double> SetCapacityMap = new HashMap<>();
    /**
     * 工位ID
     */
    @DBCondition
    @DBField
    public List<Integer> StationID = new ArrayList<>();
    /**
     * 工位名称
     */
    @DBJoinMulti(Name = "Name", MainTableField = "StationID", TableName = "fmc_station", Schemas = DBSchemas.Basic
    )
    public String StationName = "";

    /**
     * 工位编码
     */
    @DBJoinMulti(Name = "Code", MainTableField = "StationID",
            TableName = "fmc_station", Schemas = DBSchemas.Basic)
    public String StationCode = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "StationDateStartTime", ParamName2 =
            "StationDateEndTime")
    @DBField
    public Calendar StationDate = Calendar.getInstance();

    @DBCondition
    @DBField
    public int ShiftType = 0;

    @DBField
    public float PlantNum = 0.0f;

    /**
     * 班组长调整后的计划数量  增加和减少只对后续时间班次计划影响
     */
    @DBField
    public float DPlantNum = 0.0f;

    /**
     * 实际执行数量
     */
    @DBField
    public float ActNum = 0.0f;

    /**
     * 状态
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status = 0;

    //辅助属性
    /**
     * 责任班组ID集合
     */
    public List<Integer> DutyClassIDList = new ArrayList<>();
    /**
     * 责任班组名称
     */
    public String DutyClassNames = "";
    /**
     * 负责人ID集合
     */
    public List<Integer> DutyHeadIDList = new ArrayList<>();
    /**
     * 负责人名称
     */
    public String DutyHeadNames = "";

    /**
     * 是否为返修日计划
     */
    @DBCondition
    @DBField
    public int IsRepairPlan = 0;
    /**
     * 返修单ID
     */
    @DBCondition
    @DBField
    public int ProductRepairID = 0;

    /**
     * 首检状态
     * 0：不首检
     * 1；待首检
     * 2：卡控中（不运行继续生产）
     * 3：首检合格（继续批量生产）
     * 4：首检不合格（重置首检状态为待首检）
     */
    @DBCondition
    @DBField
    public int FirstCheckStatus = 0;

    @JsonProperty("OrderID")
    public int getOrderID() {
        return OrderID;
    }

    public void setOrderID(int orderID) {
        OrderID = orderID;
    }

    @JsonProperty("RoutePartID")
    public int getRoutePartID() {
        return RoutePartID;
    }

    public void setRoutePartID(int routePartID) {
        RoutePartID = routePartID;
    }

    @JsonProperty("RoutePartPointID")
    public int getRoutePartPointID() {
        return RoutePartPointID;
    }

    public void setRoutePartPointID(int routePartPointID) {
        RoutePartPointID = routePartPointID;
    }

    @JsonProperty("TaskPartID")
    public int getTaskPartID() {
        return TaskPartID;
    }

    public void setTaskPartID(int taskPartID) {
        TaskPartID = taskPartID;
    }

    @JsonProperty("TaskPartPointID")
    public int getTaskPartPointID() {
        return TaskPartPointID;
    }

    public void setTaskPartPointID(int taskPartPointID) {
        TaskPartPointID = taskPartPointID;
    }

    @JsonProperty("WorkShopID")
    public int getWorkShopID() {
        return WorkShopID;
    }

    public void setWorkShopID(int workShopID) {
        WorkShopID = workShopID;
    }

    @JsonProperty("WorkShopName")
    public String getWorkShopName() {
        return WorkShopName;
    }

    public void setWorkShopName(String workShopName) {
        WorkShopName = workShopName;
    }

    @JsonProperty("WorkShopCode")
    public String getWorkShopCode() {
        return WorkShopCode;
    }

    public void setWorkShopCode(String workShopCode) {
        WorkShopCode = workShopCode;
    }

    @JsonProperty("WorkAreaID")
    public int getWorkAreaID() {
        return WorkAreaID;
    }

    public void setWorkAreaID(int workAreaID) {
        WorkAreaID = workAreaID;
    }

    @JsonProperty("WorkAreaName")
    public String getWorkAreaName() {
        return WorkAreaName;
    }

    public void setWorkAreaName(String workAreaName) {
        WorkAreaName = workAreaName;
    }

    @JsonProperty("WorkAreaCode")
    public String getWorkAreaCode() {
        return WorkAreaCode;
    }

    public void setWorkAreaCode(String workAreaCode) {
        WorkAreaCode = workAreaCode;
    }

    @JsonProperty("StationNumMap")
    public Map<String, Float> getStationNumMap() {
        return StationNumMap;
    }

    public void setStationNumMap(Map<String, Float> stationNumMap) {
        StationNumMap = stationNumMap;
    }

    @JsonProperty("StationID")
    public List<Integer> getStationID() {
        return StationID;
    }

    public void setStationID(List<Integer> stationID) {
        StationID = stationID;
    }

    @JsonProperty("StationName")
    public String getStationName() {
        return StationName;
    }

    public void setStationName(String stationName) {
        StationName = stationName;
    }

    @JsonProperty("StationCode")
    public String getStationCode() {
        return StationCode;
    }

    public void setStationCode(String stationCode) {
        StationCode = stationCode;
    }

    @JsonProperty("StationDate")
    public Calendar getStationDate() {
        return StationDate;
    }

    public void setStationDate(Calendar stationDate) {
        StationDate = stationDate;
    }

    @JsonProperty("ShiftType")
    public int getShiftType() {
        return ShiftType;
    }

    public void setShiftType(int shiftType) {
        ShiftType = shiftType;
    }

    @JsonProperty("PlantNum")
    public float getPlantNum() {
        return PlantNum;
    }

    public void setPlantNum(float plantNum) {
        PlantNum = plantNum;
    }

    @JsonProperty("DPlantNum")
    public float getDPlantNum() {
        return DPlantNum;
    }

    public void setDPlantNum(float DPlantNum) {
        this.DPlantNum = DPlantNum;
    }

    @JsonProperty("ActNum")
    public float getActNum() {
        return ActNum;
    }

    public void setActNum(float actNum) {
        ActNum = actNum;
    }

    @JsonProperty("SetCapacityMap")
    public Map<String, Double> getSetCapacityMap() {
        return SetCapacityMap;
    }

    public void setSetCapacityMap(Map<String, Double> setCapacityMap) {
        SetCapacityMap = setCapacityMap;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("TaskPartStatus")
    public int getTaskPartStatus() {
        return TaskPartStatus;
    }

    public void setTaskPartStatus(int taskPartStatus) {
        TaskPartStatus = taskPartStatus;
    }

    @JsonProperty("OrderNo")
    public String getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(String orderNo) {
        OrderNo = orderNo;
    }

    @JsonProperty("RoutePartName")
    public String getRoutePartName() {
        return RoutePartName;
    }

    public void setRoutePartName(String routePartName) {
        RoutePartName = routePartName;
    }

    @JsonProperty("RoutePartPointName")
    public String getRoutePartPointName() {
        return RoutePartPointName;
    }

    public void setRoutePartPointName(String routePartPointName) {
        RoutePartPointName = routePartPointName;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductNo")
    public String getProductNo() {
        return ProductNo;
    }

    public void setProductNo(String productNo) {
        ProductNo = productNo;
    }

    @JsonProperty("DutyClassIDList")
    public List<Integer> getDutyClassIDList() {
        return DutyClassIDList;
    }

    public void setDutyClassIDList(List<Integer> dutyClassIDList) {
        DutyClassIDList = dutyClassIDList;
    }

    @JsonProperty("DutyClassNames")
    public String getDutyClassNames() {
        return DutyClassNames;
    }

    public void setDutyClassNames(String dutyClassNames) {
        DutyClassNames = dutyClassNames;
    }

    @JsonProperty("DutyHeadIDList")
    public List<Integer> getDutyHeadIDList() {
        return DutyHeadIDList;
    }

    public void setDutyHeadIDList(List<Integer> dutyHeadIDList) {
        DutyHeadIDList = dutyHeadIDList;
    }

    @JsonProperty("DutyHeadNames")
    public String getDutyHeadNames() {
        return DutyHeadNames;
    }

    public void setDutyHeadNames(String dutyHeadNames) {
        DutyHeadNames = dutyHeadNames;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ScanComponentType")
    public int getScanComponentType() {
        return ScanComponentType;
    }

    public void setScanComponentType(int scanComponentType) {
        ScanComponentType = scanComponentType;
    }

    @JsonProperty("IsRepairPlan")
    public int getIsRepairPlan() {
        return IsRepairPlan;
    }

    public void setIsRepairPlan(int isRepairPlan) {
        IsRepairPlan = isRepairPlan;
    }

    @JsonProperty("ProductRepairID")
    public int getProductRepairID() {
        return ProductRepairID;
    }

    public void setProductRepairID(int productRepairID) {
        ProductRepairID = productRepairID;
    }

    @JsonProperty("FirstCheckStatus")
    public int getFirstCheckStatus() {
        return FirstCheckStatus;
    }

    public void setFirstCheckStatus(int firstCheckStatus) {
        FirstCheckStatus = firstCheckStatus;
    }
}
